package org.jeecg.modules.carInformation.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.carInformation.entity.CarInformation;
import org.jeecg.modules.carInformation.mapper.CarInformationMapper;
import org.jeecg.modules.carInformation.service.ICarInformationService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 车辆信息采集数据表
 * @Author: jeecg-boot
 * @Date:   2024-07-23
 * @Version: V1.0
 */
@Service
public class CarInformationServiceImpl extends ServiceImpl<CarInformationMapper, CarInformation> implements ICarInformationService {

    @Override
    public CarInformation getByPlate(String plate) {
        LambdaQueryWrapper<CarInformation> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(CarInformation::getPlateNo, plate);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public IPage<CarInformation> pageByPlateNo(List<String> plateNo, Integer pageNo, Integer pageSize) {
        LambdaQueryWrapper<CarInformation> wrapper = Wrappers.lambdaQuery();
        wrapper.in(CarInformation::getPlateNo, plateNo);
        return baseMapper.selectPage(new Page<>(pageNo, pageSize), wrapper);
    }

}
